import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'

// 导入做适配的依赖
import 'amfe-flexible'
// 导入animate动画
import 'animate.css';
// 导入icon
import './assets/icon/iconfont.css'
// 导入ECharts
// import echarts from 'echarts'
// Vue.prototype.$echarts = echarts
// 导入elementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// 使用elementUI
Vue.use(ElementUI);
// 使用mock模拟数据
import './assets/mock/index'
// 导入vant
import Vant from 'vant';
import 'vant/lib/index.css';
import { Icon,RadioGroup, Radio,Toast  } from 'vant';
// 使用vant
Vue.use(Vant);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Icon);
Vue.use(Toast);

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

router.beforeEach( (to, from, next) => {
  if((to.path=='/home/news'||to.path=='/home/mine/note'||to.path=='/release')&&to.path!='/login'){
    if(!sessionStorage.getItem('token')){
      router.push('/login')
    }
  }
  next()
})


